#include <stdio.h>
#include <stdlib.h>
#include<string.h>
struct stud_node {
     int    num;
     char   name[20];
     int    score;
     struct stud_node *next;
};

struct stud_node *createlist();
struct stud_node *deletelist( struct stud_node *head, int min_score );

int main()
{
    int min_score;
    struct stud_node *p, *head = NULL;

    head = createlist();
    scanf("%d", &min_score);
    head = deletelist(head, min_score);
    for ( p = head; p != NULL; p = p->next )
        printf("%d %s %d\n", p->num, p->name, p->score);

    return 0;
}

struct stud_node *createlist()
{
	int number=0,score=0,i=0;
	char name[20];
	struct stud_node *p=NULL,*head=NULL,*tail=NULL;
	scanf("%d",&number);
	for(i=0;number!=0;i++)
	{
		scanf("%s %d",&name,&score);
		p=(struct stud_node *)malloc(sizeof(struct stud_node));
	    strcpy(p->name,name);
		p->score=score;
		p->num=number;
		p->next=NULL;
		if(head==NULL)head=p;
		else tail->next=p;
		tail=p;
		scanf("%d",&number);
	}
  return head;
}
struct stud_node *deletelist( struct stud_node *head, int min_score )
{struct stud_node *ptr=NULL,*ptr1=NULL;
	if(head==NULL) return NULL;
	for(ptr=head;ptr!=NULL;ptr=ptr1->next)
	{
		if(ptr->score<min_score) 
		{
			if(ptr==head) head=head->next;
			else ptr1->next=ptr->next;
			free(ptr);
		} 
		else ptr1=ptr;
	}
	return head;
}
